package com.wcsy.myblog.service.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wcsy.myblog.dao.LkPlusMapper;
import com.wcsy.myblog.entity.Lkplus;
import com.wcsy.myblog.service.ILkplusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LkpulsServiceImpl extends ServiceImpl<LkPlusMapper, Lkplus> implements ILkplusService {
    @Autowired
    LkPlusMapper lkPlusMapper;

    @Override
    public void insertLkpuls(Lkplus lkplus) {
        lkPlusMapper.insertLkpuls(lkplus);
    }

    @Override
    public Boolean selectIsLike(int userId, int articleId) {
        Lkplus lkplus = lkPlusMapper.selectOne(new QueryWrapper<Lkplus>().eq("user_id", userId).eq("article_id", articleId));
        if (lkplus!=null){
            return true;
        }
        return false;
    }

    @Override
    public void deleteLkpuls(int userId, int articleId) {
        lkPlusMapper.deleteLkpuls(userId, articleId);
    }

}
